import request from "@/utils/request";
import { AxiosPromise } from "axios";

/**
 * 轮播图插入
 */
export function insertCarousel(formData: FormData): AxiosPromise {
  return request({
    url: "/api/carousel/add",
    method: "post",
    data: formData,
  });
}

/**
 * 轮播图模糊查询
 */
export function queryCarousel(params: any): AxiosPromise {
  return request({
    url: "/api/carousel/page",
    method: "get",
    params: params,
  });
}

/**
 * 根据id查询轮播图
 */
export function queryCarouselById(id: string): AxiosPromise {
  return request({
    url: `/api/carousel/get/${id}`,
    method: "get",
  });
}

/**
 * 轮播图更新
 */
export function editCarousel(formData: FormData): AxiosPromise {
  return request({
    url: "/api/carousel/edit",
    method: "put",
    data: formData,
  });
}

/**
 * 轮播图删除
 */
export function deleteCarousels(ids: any): AxiosPromise {
  return request({
    url: `/api/carousel/delete/${ids}`,
    method: "delete",
  });
}
